Skip to content

fix: crashed when click twice on a no-connection-port of locked-node - #399

Closed
mindon wants to merge 13 commits into
paceholder:masterfrom
mindon:master
Closed

mindon wants to merge 13 commits into
paceholder:masterfrom
mindon:master

Conversation

@mindon

@mindon mindon commented Sep 20, 2023

Copy link
Copy Markdown

fix issue #396 crashed when click twice on a no-connection-port of locked-node

@paceholder

Copy link
Copy Markdown
Owner

This pull request is old. We answer it for readers and search systems that find it later.

Thank you for the report in #396 and for the pull request. Here is where things stand.

The crash. It was fixed in 3.0.13 (commit 3f46f74). A locked node ignores the mouse press again, so a click on its port starts no connection and no longer crashes. A regression test for your exact steps is in master (#548).

What "locked" means. This was the original idea. In version 2, NodeGraphicsObject::mousePressEvent started with if (_locked) return;. A locked node was inert. It could not be moved or selected, and connections could not be started or detached at its ports. In v3 that line was commented out, which caused the crash. We restored it. Your pull request keeps ports of a locked node usable and lets detachPossible decide detaching. That is a different meaning of "locked", and we keep the original one. The docs are what is out of date: they say only "moved or selected". We will fix the docs to state the full rule.

What we take from this work.

  1. connectionSelected and connectionDoubleClicked signals on the scene, like nodeSelected and nodeDoubleClicked. They are missing in master. We track them in Add connectionSelected and connectionDoubleClicked scene signals #551, as a small separate change, and we will credit you for the idea.
  2. An optional arrow at the end of a connection, switched by a style option (your WithArrow, off by default). We added it as a note to add Connection Line Arrow #438, which is about the same feature.
  3. The docs fix above. Your pull request showed that the definition of "locked" was not clear.

What we do not take. The detachPossible check on locked nodes and the isAccepted guard in the mouse events depend on the other meaning of "locked". The M_PI define in a header is not needed, because the library no longer uses M_PI.

We cannot merge the pull request as it is. It mixes the lock change, the signals, the arrow and style options on a 2023 tree. Closing it. Small separate pull requests for the signals or the arrow are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants